package com.imay.live.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.imay.base.util.ViewUtil;
import com.imay.live.R;
import com.imay.live.activity.discovery.DynamicActivity;
import com.imay.live.model.NoticeModel;
import com.imay.live.utils.GlideUtil;

import java.util.List;

/**
 * Created by  nick on 2017/4/22 0022.
 */

public class NoticeListFeedsAdapter extends BaseQuickAdapter<NoticeModel.NoticeFeedModel,BaseViewHolder> {

    public NoticeListFeedsAdapter(List data) {
        super(R.layout.item_notice_feeds,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, final NoticeModel.NoticeFeedModel item) {
        ImageView iv_notice_feed = helper.getView(R.id.iv_notice_feed);
        LinearLayout.LayoutParams params =  new LinearLayout.LayoutParams((int)(ViewUtil.getScreenWidth(mContext) - ViewUtil.dip2px(mContext,60)) / 5,(int)(ViewUtil.getScreenWidth(mContext) - ViewUtil.dip2px(mContext,60)) / 5 );
        iv_notice_feed.setLayoutParams(params);
        GlideUtil.loadImage(iv_notice_feed,item.getUrl(),R.mipmap.placeholder);
        iv_notice_feed.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                DynamicActivity.start(mContext,item.getId(), mContext.getString(R.string.str_imay_photo));
            }
        });


    }




}
